package com.yalu.service.data.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.yalu.entity.base.BaseEntity;
import com.yalu.service.data.BaseDataService;
import com.yalu.service.data.ExpressesService;
import com.yalu.service.data.ExpressfeesService;
import com.yalu.service.data.ItemDataService;
import com.yalu.service.data.ProductsService;
import com.yalu.service.data.ReasonsService;
import com.yalu.service.data.SalesService;
import com.yalu.service.data.StoresPropertiesService;
import com.yalu.service.data.StoresService;
import com.yalu.service.data.TaskcostService;
import com.yalu.service.data.WarehousesareaService;

@Service
public class BaseDataServiceImpl implements BaseDataService {

	@Resource
	private ItemDataService itemDataService;
	
	@Resource
	private StoresService storesService;
	
	@Resource
	private ProductsService productsService;
	
	@Resource
	private ReasonsService reasonsService;
	
	@Resource
	private ExpressesService expressesService;
	
	@Resource
	private StoresPropertiesService storesPropertiesService;
	
	@Resource
	private TaskcostService taskcostService;
	
	@Resource
	private ExpressfeesService expressfeesService;

	@Resource
	private WarehousesareaService warehousesareaService;
	
	@Resource
	private SalesService salesService;
	
	@Override
	public int[] save(String dataType,List<BaseEntity> entityList) {
		int[] returnCounts = new int[2];
		if(dataType.equals("itemData")){
			returnCounts =  itemDataService.save(entityList);
		}else if(dataType.equals("stores")){
			returnCounts =  storesService.save(entityList);
		}else if(dataType.equals("products")){
			returnCounts =  productsService.save(entityList);
		}else if(dataType.equals("reasons")){
			returnCounts =  reasonsService.save(entityList);
		}else if(dataType.equals("expresses")){
			returnCounts =  expressesService.save(entityList);
		}else if(dataType.equals("storesproperties")){
			returnCounts =  storesPropertiesService.save(entityList);
		}else if(dataType.equals("taskcost")){
			returnCounts =  taskcostService.save(entityList);
		}
		else if(dataType.equals("expressfees")){
			returnCounts =  expressfeesService.save(entityList);
		}
		else if(dataType.equals("warehousesarea")){
			returnCounts =  warehousesareaService.save(entityList);
		}
		else if(dataType.equals("sales")){
			returnCounts =  salesService.save(entityList);
		}
		return returnCounts;
	}
	
}
